package com.itheima.mapper;

import com.itheima.pojo.Member;
import com.itheima.pojo.OrderDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

@Mapper
public interface MemberMapper {
    /**
     * 根据名字查找会员表
     * @param name
     * @return
     */
    @Select("select  * from t_member where name like concat('%',#{name},'%')and sex=#{sex}")
    Member list(String name,String sex);

    /**
     * 注册会员
     * @param orderDTO
     */
    void insert(OrderDTO orderDTO);

    /**
     * 根据电话查找会员表
     * @param phoneNumber
     */
    @Select("select * from t_member where phoneNumber=#{phoneNumber}")
    Member phonelist(String phoneNumber);

    /**
     * 账号注册
     * @param phoneNumber,regTime
     */
    @Insert("insert into t_member (phoneNumber,regTime) value (#{phoneNumber},#{regTime})")
    void INSERT(String phoneNumber, LocalDate regTime);
}
